//俱乐部联盟
import explorer from "../librarysapi/api_explorer";
import CMountMgr from "../SuperMgr/cMountMgr"
import cMessgModule from "../Message/cMessgModule"
import cEnumMds from "../Enum/cEnumMds"
import cClubMainModule from "./cClubMainModule"
const { ccclass, property } = cc._decorator;
@ccclass
export default class cClubMainMount extends CMountMgr {
    private msgModule:cMessgModule = this.getModule(cEnumMds.mssegModule)
    
    @property(cc.Sprite) 
    private sliceds:cc.Sprite[]     = [];   //九宫格
    @property(cc.Label) 
    private txClub:cc.Label         = null; //俱乐部
    @property(cc.Label) 
    private txNotiec:cc.Label       = null; //公告
    @property(cc.Label) 
    private txCombat:cc.Label       = null; //对局
    @property(cc.Label) 
    private txMember:cc.Label       = null; //成员
    
    //组件脚本启动扩展
    protected extendStart(){
        //获取模块
        let mod:cClubMainModule = this.myModule()
        //获取数据
        let inf:s2c_clubClub = mod.getClubData()
        //加载图片
        explorer.imageRemotes(inf.logoGs,(error: Error, textures: any[])=>{
            if(!error){
                let index:number = 0
                textures.forEach(texture => {
                    this.sliceds[index++].spriteFrame = new cc.SpriteFrame(texture)
                })
            }
        })
        //联盟名称
        this.txClub.string = inf.club.clubName
        //个性签名
        this.txNotiec.string = inf.club.personality
        //游戏对局
        this.txCombat.string = `${inf.club.combatNumber}个牌局进行中`
        //俱乐部人数
        this.txMember.string = inf.club.memberNumber.toString()

    }
}
